<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'defaultRoute' => 'home',
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            "enableCsrfValidation"=>false,
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the frontend
            //'name' => 'advanced-frontend',
            'class' => 'yii\web\DbSession',
            'db' => 'db',
            'sessionTable' => 'session',
            //one month
            'timeout' => '2592000',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'common\components\FileTarget',
                    'levels' => ['error', 'warning'],
                    'enableDatePrefix' => true,
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'enableStrictParsing' => false,
            'rules' => [
            ],
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' =>false,
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.exmail.qq.com',
                'username' => 'dev@li@findobj.com',
                'password' => 'Pass1024',
                'port' => '465',
                'encryption' => 'SSL',
            ],
            'messageConfig'=>[
                'charset'=>'UTF-8',
                'from'=>['dev@li@findobj.com'=>'dev@li']
            ],
        ],
    ],
    'params' => $params,
    'modules' => [
        'forum' => [
            'class' => 'frontend\modules\forum\Module',
        ],
        'dev' => [
            'class' => 'frontend\modules\dev\Module',
        ],
        'api' => [
            'class' => 'frontend\modules\api\Module',
        ],
    ],
];
